package com.dubbo.lian.common.util;

/**
 * Created by Administrator on 2017/2/23 0023.
 */
public class VersionUtil {
    public static boolean isAppNewVersion(String localVersion, String onlineVersion)
    {
        if (localVersion.equals(onlineVersion))
        {
            return false;
        }
        String[] localArray = localVersion.split("\\.");
        String[] onlineArray = onlineVersion.split("\\.");
        int length = localArray.length < onlineArray.length ? localArray.length : onlineArray.length;
        for (int i = 0; i < length; i++)
        {
            if (Integer.parseInt(onlineArray[i]) > Integer.parseInt(localArray[i]))
            {
                return true;
            }
            else if (Integer.parseInt(onlineArray[i]) < Integer.parseInt(localArray[i]))
            {
                return false;
            }

        }
        return true;
    }
}
